package systeminfo

import (
	"golang.org/x/sys/windows"
)

type Data struct {
	Uptime string `json:"uptime"`
	Ram    Ram    `json:"ram"`
	Cpu    Cpu    `json:"cpu"`
	Hdd    []Hdd  `json:"hdd"`
}

type Ram struct {
	Totalram  string `json:"totalram"`
	Freeram   string `json:"freeram"`
	Totalswap string `json:"totalswap"`
	Freeswap  string `json:"freeswap"`
}

type Cpu struct {
	CpuUsage string `json:"cpuusage"`
	Busy     string `json:"busy"`
	Total    string `json:"total"`
}

type Hdd struct {
	Path string `json:"path"`
	All  string `json:"allhdd"`
	Used string `json:"usedhdd"`
	Free string `json:"freehdd"`
}

type Win32_OperatingSystem struct {
	LastBootUpTime string
}

func getUptime() string {
	uptime := windows.DurationSinceBoot()
	return uptime.String()
}

func GetSensorsData() (data Data) {
	data.Uptime = getUptime()
	data.Cpu = GetCpuStatus()
	data.Hdd = GetHDDStatus()
	data.Ram = GetRamStatus()
	return
}
